﻿using System;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework;

namespace TicTacToeX {
	public static class Input {
		
		public static KeyboardState KeyState;
		public static MouseState MouseState;
		public static MouseState MouseStateAux;
		public static Vector2 MousePosition;

		public static void UpdateMousePosition() {
			MousePosition = new Vector2(MouseState.X,MouseState.Y);
		}

		public static void UpdateInputState() {
			KeyState   = Keyboard.GetState();
			MouseState = Mouse.GetState();
		}

		public static void RunEscape(Game currentGame) {
			if(!KeyState.IsKeyDown(Keys.Escape)) return;
			currentGame.Exit();
		}

		public static bool VerifyMouseClick(Vector2 finalPos) {
			return ((Input.MousePosition.Y > finalPos.Y && Input.MousePosition.Y < finalPos.Y + Size.Grid.Y) &&
				(Input.MousePosition.X > finalPos.X && Input.MousePosition.X < finalPos.X + Size.Grid.X)) ? true : false;
		}
	}
}
